package com.zhxh.nzpos.buyin;

import java.util.ArrayList;
import java.util.HashMap;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import android.widget.SimpleAdapter;

import com.zhxh.nzpos.BaseActivity;
import com.zhxh.nzpos.R;

/**
 * 进货管理主界面
 * @author wangzt
 *
 */
public class BuyInManageActivity extends BaseActivity {

	public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_buyin_manage);
        initViews();
    }
	
	private void initViews() {
		GridView gridView = (GridView) findViewById(R.id.grid_buyin);

		ArrayList<HashMap<String, Object>> imagelist = new ArrayList<HashMap<String, Object>>();
		HashMap<String, Object> map1 = new HashMap<String, Object>();
		map1.put("image", R.drawable.goods_order);
//		map1.put("text", getResources().getString(R.string.buyin_goods_order));
		imagelist.add(map1);
		HashMap<String, Object> map2 = new HashMap<String, Object>();
		map2.put("image", R.drawable.buyin_confirm);
//		map2.put("text", getResources().getString(R.string.buyin_confirm));
		imagelist.add(map2);
		
		SimpleAdapter simpleAdapter = new SimpleAdapter(this, imagelist,
				R.layout.compose_grid_item, new String[] { "image"},
				new int[] { R.id.compose_grid_image});
		gridView.setAdapter(simpleAdapter);
		
		gridView.setOnItemClickListener(new OnItemClickListener() {
			public void onItemClick(AdapterView<?> arg0, View arg1, int pos,
					long arg3) {
				Intent intent = new Intent();
				switch (pos) {
				case 0:
					intent.setClass(getApplicationContext(), GoodsOrderActivity.class);
					startActivity(intent);
					break;
				case 1:
					intent.setClass(getApplicationContext(), BuyInConfirmActivity.class);
					startActivity(intent);
					break;

				}
			}
		});
	}
}
